import { service } from "@/utils";

// 单文件上传
export function uploadSingle(data, config) {
  return service.post("/upload_single", data, config);
}

// base64 上传
export function uploadSingleBase64(data) {
  return service.post("/upload_single_base64", data, {
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
  });
}

// 处理文件名
export function uploadSingleHashName(data, config) {
  return service.post("/upload_single_name", data, config);
}

export function isFileExist(params) {
  return service.get("/isFileExist", { params });
}

// 校验已上传分片
export function uploadAlready(params) {
  return service.get("/upload_already", { params });
}
// 上传文件分片
export function uploadChunk(data, config) {
  return service.post("/upload_chunk", data, config);
}
// 合并文件分片
export function mergeChunk(data) {
  return service.post("/upload_merge", data, {
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
  });
}
